import 'package:flutter/material.dart';

//按给定的轴方向，按照顺序排列子节点。
class ListBodyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: new AppBar(
          title: new Text("ListBody"),
          leading: new BackButton(),
        ),
        body: new Flex(
          direction: Axis.vertical,
          children: <Widget>[
            ListBody(
              mainAxis: Axis.vertical,
              reverse: false,
              children: <Widget>[
                Container(
                  color: Colors.red,
                  width: 50.0,
                  height: 50.0,
                ),
                Container(
                  color: Colors.yellow,
                  width: 50.0,
                  height: 50.0,
                ),
                Container(
                  color: Colors.green,
                  width: 50.0,
                  height: 50.0,
                ),
                Container(
                  color: Colors.blue,
                  width: 50.0,
                  height: 50.0,
                ),
                Container(
                  color: Colors.black,
                  width: 50.0,
                  height: 50.0,
                ),
              ],
            )
          ],
        ));
  }
}
